* Pulse of the spinner. Increment this value to draw the next frame of the
* spinner animation. Usually, you would update this value in a timeout.
*
- * The #GtkSpinner widget draws one full cycle of the animation per second.
+ * The #GtkSpinner widget draws one full cycle of the animation per second by default.
* You can learn about the number of frames used by the theme
- * by looking at the #GtkSpinner:num-steps style property
+ * by looking at the #GtkSpinner:num-steps style property and the duration
+ * of the cycle by looking at #GtkSpinner:cycle-duration.
*
* Since 2.20
*/
{
guint current;
guint num_steps;
+ guint cycle_duration;
guint timeout;
};
* GtkSpinner:num-steps:
*
* The number of steps for the spinner to complete a full loop.
- * The animation will complete a full cycle in one second.
+ * The animation will complete a full cycle in one second by default
+ * (see the #GtkSpinner:cycle-duration style property).
*
* Since: 2.20
*/
gtk_widget_class_install_style_property (widget_class,
g_param_spec_uint ("num-steps",
P_("Number of steps"),
- P_("The number of steps for the spinner to complete a full loop. The animation will complete a full cycle in one second."),
+ P_("The number of steps for the spinner to complete a full loop. The animation will complete a full cycle in one second by default (see #GtkSpinner::cycle-duration)."),
1,
G_MAXUINT,
12,
G_PARAM_READABLE));
+
+ /**
+ * GtkSpinner::cycle-duration:
+ *
+ * The duration in milliseconds for the spinner to complete a full cycle.
+ *
+ * Since: 2.20
+ */
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_uint ("cycle-duration",
+ P_("Animation duration"),
+ P_("The length of time in milliseconds for the spinner to complete a full loop"),
+ 500,
+ G_MAXUINT,
+ 1000,
+ G_PARAM_READABLE));
}
static void
gtk_widget_style_get (GTK_WIDGET (widget),
"num-steps", &(priv->num_steps),
+ "cycle-duration", &(priv->cycle_duration),
NULL);
if (priv->current > priv->num_steps)
if (priv->timeout != 0)
return;
- priv->timeout = gdk_threads_add_timeout (1000 / priv->num_steps, gtk_spinner_timeout, spinner);
+ priv->timeout = gdk_threads_add_timeout (priv->cycle_duration / priv->num_steps, gtk_spinner_timeout, spinner);
g_object_notify (G_OBJECT (spinner), "active");
}